function showTime(){
	var d = new Date();
	var y = d.getFullYear();
	var mon =  d.getMonth();
	var date = d.getDate();
	var h = d.getHours();
	var min = d.getMinutes();
	if(min<10) min = "0" + min;
	var s = d.getSeconds();
	if(s<10) s = "0" + s;
	return y + "-" + mon + "-" + date + " " + h + ":" + min + ":" + s
}
console.log(showTime())//测试

//页面加载事件
window.onload = function(){
	var time = showTime()
	document.getElementById("time").imnerHTML = time;
	//定时函数
	window.setInterval(function(){
		var time = showTime()
		document.getElementById("time").innerHTML = time;
	},1000)
	showImg()
	window.setInterval(showImg,4000)
	var numsLis = document.getElementById("nums").getElementsByTagName("li");
	for (var i = 0; i<numsLis.length; i++){
		numsLis[i].onclick = function(){
			console.log(this.innerHTML)
			var li_index= parseInt(this.innerHTML) - 1;
			showImg();
		}
	}
}

function soso(){
	//获得搜索框的值
	var content= document.getElementById('content').value;
	alert("搜索哦内容是："+content)
}

/*图片切换*/
	var index = 0;
function showImg(){
	var imgsLis = document.getElementById("imgs").getElementsByTagName("li");
	var numsLis = document.getElementById("nums").getElementsByTagName("li");
	
	for(var i = 0; i<imgsLis.length; i++){
		if(i == index){
			imgsLis[i].style.display = 'block';
			numsLis[i].style.backgroundColor='red';
		}else{
			
			imgsLis[i].style.display = 'none';
			numsLis[i].style.backgroundColor='#808080';
			}
		
	}
	index ++;
	if(index == imgsLis.length){
		index = 0;
	}
}
